<?php
$this->breadcrumbs = array(
	'Nhân vật Sự kiện'=>array('/Events/artists/index'),
	'Nhân vật'
);
?>

<!-- BEGIN PORTLET-->
<div class="row">
	<div class="col-md-12">
        <div class="portlet">
        	<div class="portlet-title">
            	<div class="caption"><i class="icon-add"></i> Thêm sự kiện</div>
            </div>
            <div class="portlet-body">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'artist-form',
	'action'=>array('/Events/artists/addEvent', 'url'=>$model->url),
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
	),
)); ?>
<div class="form-body">
	<div class="row">
    	<div class="col-md-9">
            <div class="form-group">
                <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
					//'model'=>$label,
					//'attribute'=>'id',
					'name'=>'event_title',
					'source'=>$this->createUrl('/Events/request/suggestEvent'),
					'options'=>array(
						'minLength' => '2',
						'showAnim' => 'fold',
						'select' => "js: function(event, data) {
							$('#EventArtists_event_id').val(data.item.id);
						}"
					),
					'htmlOptions'=>array(
						'class'=>'form-control'
					),
				)); ?>
                <?php echo $form->hiddenField($artist, 'event_id'); ?>
                <?php echo $form->hiddenField($artist, 'artist_id', array('value'=>$model->id)); ?>
            </div>
		</div>
        <div class="col-md-3">
            <button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> Thêm sự kiện</button>
            <button type="reset" class="btn default">Cancel</button>
        </div>
	</div>
</div>
<?php $this->endWidget(); ?>
            </div>
        </div>

    	<div class="portlet">
        	<div class="portlet-title">
            	<div class="caption"><i class="icon-bar-chart"></i>Danh sách sự kiện</div>
            </div>
            <div class="portlet-body">
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'event-grid',
	'dataProvider'=>$dataProvider,
	//'filter'=>$reports,
	'itemsCssClass'=>'table table-striped table-bordered table-advance table-hover',
	//'pagerCssClass'=>'pagination pagination-sm',
	'pager'=>array(
        'header'=>'',
		'maxButtonCount'=>10,
        'header'=>'',
        'prevPageLabel'=>'<i class="icon-angle-left"></i></a>',
        'nextPageLabel'=>'<i class="icon-angle-right"></i></a>',
        'firstPageLabel'=>'First',
        'lastPageLabel'=>'Last',
        'footer'=>'',
		'selectedPageCssClass'=>'active',
		'hiddenPageCssClass'=>'disabled',
        'htmlOptions'=>array(
            'class'=>'pagination pagination-sm',
        ),
    ),
	'columns'=>array(
		'id',
		'title',
		array(
			'name'=>'posteddate',
			'value'=>'date("d-m-Y H:i:s", strtotime($data->posteddate))',
		),
		array(
			'class'=>'CButtonColumn',
			'header'=>'Action',
			'template'=>'{delete}',
			'buttons'=>array
			(
				'view'=>array(
					'label'=>'<i class="icon-share"></i>',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs blue',
						'title'=>'View'
					),
				),
				'update'=>array(
					'label'=>'<i class="icon-edit"></i>',
					'imageUrl'=>false,
					'url'=>'array("/Events/default/update", "id"=>$data->id)',
					'options'=>array(
						'class'=>'btn default btn-xs green',
						'title'=>'Edit'
					),
				),
				'delete'=>array(
					'label'=>'<i class="icon-trash"></i>',
					'imageUrl'=>false,
					'url'=>'array("/Events/artists/removeEvent", "artist"=>' . $model->id . ', "event"=>$data->id)',
					'options'=>array(
						'class'=>'btn default btn-xs black',
						'title'=>'Xóa khỏi Nhân vật'
					),
				),
			),
			'htmlOptions'=>array(
				'width'=>'100px',
				'class'=>'text-center'
			),
		),
	),
	'htmlOptions'=>array(
		'class'=>''
	),
)); ?>
            </div>
        </div>
    </div>
</div>
<!-- END PORTLET-->